home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_dooroneway.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  114 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_DoorOneWay.cog
  4. #
  5. # 1-way Door Script. Depends on player being in ONE particular sector
  6. # to open the door. Not usable in multiplayer.
  7. # Added user0 message to allow door to be opened by outside script.
  8. #
  9. # [RD]
  10. #
  11. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  12. # ========================================================================================
  13.  
  14. symbols
  15. message    startup
  16. message    activated    
  17. message    arrived        
  18. message    blocked
  19. message    timer
  20. message    user0
  21.  
  22. thing        door
  23. thing        player    local
  24.  
  25. sector    inside            // The sector that the door is opened from
  26. sector    doorsector    local
  27.  
  28. flex    movespeed=8.0
  29. flex    sleeptime=2.0
  30.  
  31. int        locked=0    local
  32.  
  33. # subroutines
  34. flex    opendoor=0.0    local
  35. end
  36.  
  37. # ========================================================================================
  38.  
  39. code
  40.  
  41. startup:
  42.     doorsector = GetThingSector(door);
  43.     SetSectorAdjoins(doorsector, 0);
  44.     return;
  45.  
  46. # ........................................................................................
  47.  
  48. activated:
  49.     if (IsThingMoving(door)) return;
  50.     if (locked) return;
  51.  
  52.     if (GetThingSector(GetLocalPlayerThing()) == inside)
  53.     {
  54.         call opendoor;
  55.     }
  56.     else
  57.     {
  58.         locked = 1;
  59.         // PlaySoundLocal(locked0[(Rand() * 2)], 1, 0.0, 0);
  60.         // jkPrintUNIString(-1, 1001);
  61.         SetTimer(.8);
  62.     }
  63.     return;
  64.  
  65. # ........................................................................................
  66.  
  67. user0:
  68.     call opendoor;
  69.     return;
  70.  
  71. # ........................................................................................
  72.  
  73. opendoor:
  74.     SetSectorAdjoins(doorsector, 1);
  75.     locked = 1;
  76.     MoveToFrame(door, 1, movespeed);
  77.     return;
  78.     
  79. # ........................................................................................
  80.  
  81. arrived:
  82.     if (GetCurFrame(door) == 0)
  83.     {
  84.         SetSectorAdjoins(doorsector, 0);
  85.         locked = 0;
  86.     }
  87.     else
  88.     {
  89.         SetTimer(sleeptime);
  90.     }
  91.     return;
  92.  
  93. # ........................................................................................
  94.  
  95. blocked:
  96.     MoveToFrame(door, 1, movespeed);
  97.     return;
  98.  
  99. # ........................................................................................
  100.  
  101. timer:
  102.     if (GetCurFrame(door) == 1)
  103.     {
  104.         MoveToFrame(door, 0, movespeed);
  105.     }
  106.     else
  107.     {
  108.         locked = 0;
  109.     }
  110.     return;
  111.  
  112. end
  113.  
  114.